<template>


	

	<view class="container">
		<u-form-item label="信息集" borderBottom prop="fileList">
			<jp-form-upload v-model="fileList" :disabled="false"  ></jp-form-upload>
		</u-form-item>
		<uni-table>
			<uni-tr v-for="(item, index) in currentPageData" :key="index">
				<!-- 表格内容 -->
				<uni-td>{{ item.name }}</uni-td>
				<uni-td>{{ item.age }}</uni-td>
			</uni-tr>
		</uni-table>

		<view class="pagination-wrapper">
			<uni-pagination :total="total" :current="currentPage" :pageSize="pageSize" @change="handlePageChange" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

				fileList: [],

				allData: [], // 存储所有数据
				currentPageData: [], // 当前页显示的数据
				currentPage: 1, // 当前页码
				pageSize: 10, // 每页条数
				total: 0 // 总条数
			}
		},
		created() {
			this.fetchAllData();
		},
		methods: {
			// 获取所有数据
			async fetchAllData() {
				const res = {
					data: [{
							name: "小明1",
							age: "121"
						},
						{
							name: "小明2",
							age: "122"
						},
						{
							name: "小明3",
							age: "123"
						},
						{
							name: "小明4",
							age: "124"
						},
						{
							name: "小明5",
							age: "125"
						},
						{
							name: "小明6",
							age: "126"
						},
						{
							name: "小明7",
							age: "127"
						},
						{
							name: "小明8",
							age: "128"
						},
						{
							name: "小明9",
							age: "129"
						},
						{
							name: "小明10",
							age: "130"
						},
						{
							name: "小明11",
							age: "131"
						},
						{
							name: "小明12",
							age: "132"
						}
					]
				};
				this.allData = res.data;
				this.total = res.data.length;
				this.updateCurrentPageData();
			},
			// 更新当前页数据
			updateCurrentPageData() {
				const start = (this.currentPage - 1) * this.pageSize;
				const end = start + this.pageSize;
				this.currentPageData = this.allData.slice(start, end);
			},
			// 分页改变
			handlePageChange(e) {
				this.currentPage = e.current;
				this.updateCurrentPageData();
			}
		}
	}
</script>
<style>
	.container {
		position: relative;
		padding-bottom: 60px;
		/* 留出分页器高度空间 */
		min-height: 100vh;
	}

	.pagination-wrapper {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background: #fff;
		padding: 10px;
		box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
		z-index: 100;
	}
</style>